<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">

<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title>DOMAssistantContent module - DOM Assistant, the modular lightweight JavaScript library</title>
	<style type="text/css">
		@import url("css/domassistant.css");
	</style>
	<!--[if lt IE 7]>
		<link rel="stylesheet" href="css/ie.css" type="text/css">
	<![endif]-->
</head>

<body>
	
	<div id="container">
		<div id="inner-container">
			<div id="main-content">
				<h1><a href="index.htm"><span></span>DOMAssistant</a></h1>
				<h2>DOMAssistantContent module</h2>
				<p>Here you will find a general documentation for the DOMAssistantContent module.</p>
				<h3 id="domass-module">Module documentation</h3>
				<p>The DOMAssistantContent module offers various methods for adding and removing content and elements to the page. These methods are:</p>
				
				<h4>Methods</h4>
				<ul>
					<li><a href="#prev">prev</a></li>
					<li><a href="#next">next</a></li>
					<li><a href="#create">create</a></li>
					<li><a href="#setattributes">setAttributes</a></li>
					<li><a href="#addcontent">addContent</a></li>
					<li><a href="#replacecontent">replaceContent</a></li>
					<li><a href="#remove">remove</a></li>
				</ul>
				
				<h4 id="prev"><code>prev()</code></h4>
				<p>Gets a reference to the previous HTML element, automatically bypassing any text nodes that might in between.</p>
				<h5>Parameters</h5>
				<p>None.</p>
				
				<h5>Example calls</h5>
<pre><code>
// Returns element reference
$("container").prev();
</code></pre>

				<h4 id="next"><code>next()</code></h4>
				<p>Gets a reference to the next HTML element, automatically bypassing any text nodes that might in between.</p>
				<h5>Parameters</h5>
				<p>None.</p>
				
				<h5>Example calls</h5>
<pre><code>
// Returns element reference
$("container").next();
</code></pre>

				<h4 id="create"><code>create(name, attr, append, content)</code></h4>
				<p>Creates an element, and optionally sets attributes on it, appends it to the current element and adds content to it.</p>
				<h5>Parameters</h5>
				<dl>
					<dt>name</dt>
					<dd>Tag name for the new element. Required.</dd>
					<dt>attr</dt>
					<dd>An object containing attributes and their values. Optional.</dd>
					<dt>append</dt>
					<dd>Boolean if the new element should be appended right away. Optional.</dd>
					<dt>content</dt>
					<dd>A string or HTML object that will become the content of the newly created element. Optional.</dd>
				</dl>
				
				<h5>Example calls</h5>
<pre><code>
// Creates a DIV element
$("container").create("div");
// Creates a DIV element and sets some attributes
$("container").create("div", {
	id : "my-div",
	className : "my-class"
});
// Creates a DIV element and sets its content to the text "Hello!"
$("container").create("div", null, false, "Hello!");
/* 
	Creates a DIV element, sets its content to the text
	"Hi there!" and appends it to the parent element
*/
$("container").create("div", {
	id : "my-div",
	className : "my-class"
}, true, "Hi there!");
</code></pre>

				<h4 id="setattributes"><code>setAttributes(attr)</code></h4>
				<p>Sets attributes on the current element.</p>
				<h5>Parameters</h5>
				<dl>
					<dt>attr</dt>
					<dd>An object containing attributes and their values. Required.</dd>
				</dl>
				
				<h5>Example calls</h5>
<pre><code>
// Sets some attributes on the element named "container"
$("container").setAttributes({
	id : "my-div",
	className : "my-class"
});
</code></pre>

				<h4 id="addcontent"><code>addContent(content)</code></h4>
				<p>Adds content to the current element.</p>
				<h5>Parameters</h5>
				<dl>
					<dt>content</dt>
					<dd>Can either be a string, which will then be applied using <code>innerHTML</code>, or an HTML object that will be applied using <code>appendChild</code>.</dd>
				</dl>
				
				<h5>Example calls</h5>
<pre><code>
// Adds content, using innerHTML, to the element named "container"
$("container").addContent("&lt;p&gt;A new paragraph&lt;/p&gt;");
// Adds content, using an element, to the element named "container"
$("container").addContent(document.createElement("p"));
</code></pre>

				<h4 id="replacecontent"><code>replaceContent(newContent)</code></h4>
				<p>Replaces the content of the current element with new content.</p>
				<h5>Parameters</h5>
				<dl>
					<dt>newContent</dt>
					<dd>Can either be a string, which will then be applied using <code>innerHTML</code>, or a HTML object that will be applied using <code>appendChild</code>.</dd>
				</dl>
				
				<h5>Example calls</h5>
<pre><code>
// Replaces content in the element named "container" (innerHTML)
$("container").replaceContent("&lt;p&gt;A new paragraph&lt;/p&gt;");
// Replaces content in the element named "container" (new element)
$("container").replaceContent(document.createElement("p"));
</code></pre>

				<h4 id="remove"><code>remove()</code></h4>
				<p>Removes the current element.</p>
				<h5>Parameters</h5>
				<p>None.</p>
				
				<h5>Example calls</h5>
<pre><code>
// Removes the element named "container"
$("container").remove();
</code></pre>
			
			</div>
			
			<div id="navigation">
				<div id="navigation-inner">
					<p><em>Current version is 2.0, released September 19th 2007.</em></p>
					<p><em>November 8th 2007 update: <code>elmsByAttribute</code> update. <a href="Release-notes.txt">Release notes</a></em></p>
					<h3>Information</h3>
					<ul>
						<li><a href="index.htm">Introduction</a></li>
						<li><a href="compatibility.htm">Compatibility</a></li>
						<li><a href="demo.htm">Demo</a></li>
					</ul>
				
					<h3>Module documentation</h3>
					<ul>
						<li><a href="modules-domassistant.htm">DOMAssistant</a></li>
						<li><a href="modules-domassistant-ajax.htm">DOMAssistantAJAX</a></li>
						<li><a href="modules-domassistant-content.htm" class="selected">DOMAssistantContent</a></li>
						<li><a href="modules-domassistant-css.htm">DOMAssistantCSS</a></li>
						<li><a href="modules-domassistant-events.htm">DOMAssistantEvents</a></li>						
						<li><a href="modules-domassistant-load.htm">DOMAssistantLoad</a></li>
						<li><a href="documentation/DOMAssistant-documentation.pdf">Complete documentation (PDF)</a></li>
						<li><a href="documentation/DOMAssistant-diagram.pdf">Diagram with all modules and methods (PDF)</a></li>
					</ul>
	
					<h3>Downloads</h3>
					
					<h4>Complete files with all modules</h4>
					<ul>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantCompressed-2.0.js&amp;can=2&amp;q=#makechanges" title="Download DOMAssistantCompressed.js at Google code">Compressed (10.5 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantComplete-2.0.js&amp;can=2&amp;q=#makechanges" title="Download DOMAssistantComplete.js at Google code">Uncompressed (15.7 kb)</a></li>
					</ul>
					
					<h4>Module by module</h4>
					<ul>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistant-2.0-modules.zip&amp;can=2&amp;q=#makechanges" title="Download DOMAssistant-2.0-modules.zip at Google code">All DOMAssistant modules ZIP file (8.8 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistant-2.0.js&amp;can=2&amp;q=" title="Download DOMAssistant.js at Google code">DOMAssistant (4.2 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantAJAX-2.0.js&amp;can=2&amp;q=" title="Download DOMAssistantAJAX.js at Google code">DOMAssistantAJAX (1.4 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantContent-2.0.js&amp;can=2&amp;q=" title="Download DOMAssistantContent.js at Google code">DOMAssistantContent (3.3 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantCSS-2.0.js&amp;can=2&amp;q=" title="Download DOMAssistantCSS.js at Google code">DOMAssistantCSS (2.5 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantEvents-2.0.js&amp;can=2&amp;q=" title="Download DOMAssistantEvents.js at Google code">DOMAssistantEvents (2.2 kb)</a></li>
						<li><a href="http://code.google.com/p/domassistant/downloads/detail?name=DOMAssistantLoad-2.0.js&amp;can=2&amp;q=" title="Download DOMAssistantLoad.js at Google code">DOMAssistantLoad (2.1 kb)</a></li>
					</ul>
								
					<h3>Comments/updates</h3>
					<ul>
						<li><a href="http://www.robertnyman.com/2007/01/25/domass-the-dom-assistant/">First release blog post with comments and information</a></li>
						<li><a href="http://www.robertnyman.com/2007/09/20/releasing-domassistant-20-chainability-ajax-module-domready-xpath-and-more/">Version 2.0 release blog post with comments and information</a></li>
					</ul>
					
					<h3>Sign up for updates</h3>
					<p>Send an e-mail to domassistant [at] robertnyman [dot] com to verify your e-mail address and receive information about updates</p>
				
					<h3>Contact</h3>
					<ul>
						<li><a href="http://www.robertnyman.com/about">Contact the author</a></li>
					</ul>
				</div>	
				
			</div>		
		</div>
		
		<div id="footer">
			Created by Robert Nyman, <a href="http://www.robertnyman.com">http://www.robertnyman.com</a>
		</div>
		
	</div>
	
	<!-- Google Analytics code -->
	<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
	<script type="text/javascript">
		_uacct = "UA-56164-1";
		urchinTracker();
	</script>
	
	<!-- Start of StatCounter Code -->
	<script type="text/javascript">
	<!-- 
	var sc_project=593937; 
	var sc_partition=4; 
	var sc_security="175a1fec"; 
	//-->
	</script>
		
	<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c5.statcounter.com/counter.php?sc_project=593937&amp;java=0&amp;security=175a1fec" alt="free geoip" /></a></div></noscript>
	<!-- End of StatCounter Code -->
	
	<!-- gVisit code -->
	<script type="text/javascript" src="http://www.gvisit.com/record.php?sid=de2c9dfeacdc0124bdb3fe3eab766832"></script>
	
</body>
</html>